package com.csgsystems.im.survey.persistence.hibernate;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;

import com.csgsystems.im.hibernate.HibernateDao;
import com.csgsystems.im.survey.Survey;
import com.csgsystems.im.survey.persistence.SurveyDao;

public class SurveyDaoImpl extends HibernateDao<Survey, Long> implements SurveyDao {

	@Override
	public List<Survey> findByHierarchyItem(long hierarchyItemId) {
		Session session = sessionFactory.getCurrentSession();
		Query query =  session.createQuery("from Survey s " +
				"where s.hierarchyItemId = :hierarchyItemId");
		query.setLong("hierarchyItemId", hierarchyItemId);
		return query.list();
		
	}



}
